<template>
  <view @click="isDrawer = true">
    <slot>
      <el-button type="primary" link>配置</el-button>
    </slot>
  </view>
  <el-drawer
    :append-to-body="true"
    v-model="isDrawer"
    title="配置"
    :size="drawerSize"
  >
    <slot name="content">
      <component v-if="isDrawer" :is="component" v-model:param="param" />
    </slot>
  </el-drawer>
</template>

<script>
export default {
  props: ["component", "componentParam"],
  data() {
    return {
      isDrawer: false,
      drawerSize: "80%",
      param: this.componentParam,
    };
  },
  mounted() {
    if (this.component) {
      this.drawerSize = this.component.width;
    }
  },
};
</script>

<style></style>
